<template>
   <div class="fillet box-bg  aside-box">
       <h3   class="tac ab_title">{{title}}</h3>
       <ul
      
      
       v-if="type=='about'"
       class="aside-list">
       <li class="item">昵称：lsdfly | 梁胜德</li>
       <li class="item">职业：全栈</li>
       <li class="item">个人微信：lsdfly</li>
       <li class="item">邮箱：381888954@qq.com</li>
       </ul>
      <ul
       v-if='type=="post"'
       v-loading="loading"
       class="aside-list">
         <li  class="item cp"  v-for="(v,index) in posts" :key="index">
              {{index+1}}.
             {{v.title}}
             </li>
       </ul>
  </div>
</template>
<script>
import api from "@/api";
export default {
  name: "SlideWidget",
  created() {
    // this.loading = true;
    // console.log(this)
    if (this.type == "post") {
      api
        .queryPost({
          size: 10
        })
        .then(res => {
          this.loading = false;
          console.log(this);
          // debugger;
          this.posts = res.data.data;
        });
    }
  },
  data() {
    return {
      posts: []
    };
  },
  props: {
    type: {
      type: String,
      default: "post"
    },
    // 初始value
    title: {
      type: String,
      default: ""
    },
    size: {
      type: Number,
      default: 10
    },
    sort: {
      type: String,
      default: "time"
    }
  }
};
</script>
<style scoped>
.aside-box {
  margin-bottom: 12px;
  padding-left: 12px;
  padding-right: 12px;
}
.ab_title {
  text-align: center;
  position: relative;
  /* margin: 20px; */
  line-height: 40px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 5px;
}
.aside-list .item {
  line-height: 40px;
  height: 40px;
  border-bottom: 1px dashed #ccc;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.aside-list .item:last-child {
  border-bottom: 0;
}
</style>


